jQuery(function(){
	$.divselect("#divselect_pp_category", "#category");
	$.divselect("#divselect_pp_level", "#isEmergency");
});

var addProduce = function(){
	validate();
	var fun = function(msg) {
		if (msg.result == "success") {
			layer.msg("新建生产任务成功！",1,9,function(){
				window.location.href=globePath+"/produce/toAddProduceDetail.htm?produceId="+msg.produceId;
			});
		} else {
			layer.alert(msg.result);
		};
	};
	
	ajaxCommFunWithDataType(globePath+"/produce/submitPProduce.htm", $("#addProduceForm").serialize(),'json',fun);
};

var validate = function(){
	var name = $.trim($("#name").val());
	if(name==''){
		layer.msg("生产任务名称不能为空");
		return false;
	}
};